from mediator import mediator
from mediator . tests . test_assistant import make_mediator_test_keyword_args

class gui_fake :
    def __init__ ( self ) :
        self . _frame = None
        self . _received_destroy_frame_args = None
        self . _gui_create_frame_request = None
    def gui_create_frame_request ( self , master ) :
        self . _gui_create_frame_request = master
    def gui_destroy_frame ( self , frame ) :
        self . _received_destroy_frame_args = [ frame ]

class mediator_gui_frame_tests : 
    'mediator_gui_frame'
    def __init__ ( self , test ) :
        self . _test = test
        self . _gui = gui_fake ( )
        self . _mediator = mediator ( )
        self . _mediator . register_modules ( ** make_mediator_test_keyword_args \
            ( 'gui' 
            , self . _gui 
            , None
            ) )
    def test_gui_create_frame_request ( self ) :
        self . _mediator . gui_create_frame_request ( 'my master' )
        self . _test . assume_equal ( self . _gui . _gui_create_frame_request , 'my master' )
    def test_gui_destroy_frame ( self ) :
        self . _mediator . gui_destroy_frame ( 'my frame' )
        self . _test . assume_equal ( self . _gui . _received_destroy_frame_args ,
            [ 'my frame' 
            ] )
